package com.belinked_client.room_chat;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.Log;
import android.view.View;

class Compuss_view extends View {
   
	private Paint   mPaint = new Paint();
    private Path    mPath = new Path();
    private boolean mAnimate;
    private long    mNextTime;
    private float []mValues;
    public Compuss_view(Context context,float[] mValues) {
		super(context);
		// TODO Auto-generated constructor stub
		  this.mValues = mValues; 
		  mPath.moveTo(0, -50);
	      mPath.lineTo(-20, 60);
	      mPath.lineTo(0, 50);
	      mPath.lineTo(20, 60);
	      mPath.close();
	}
    void updata(float []values)
    {
    	mValues = values;
    }

    @Override 
    protected void onDraw(Canvas canvas) {
        Paint paint = mPaint;

        canvas.drawColor(Color.WHITE);
        
        paint.setAntiAlias(true);
        paint.setColor(Color.BLACK);
        paint.setStyle(Paint.Style.FILL);
        int w = 100;
        int h = 100;

//        int w = canvas.getWidth();
//        int h = canvas.getHeight();
        int cx = w / 2;
        int cy = h / 2;

        canvas.translate(cx, cy);
        if (mValues != null) {
        	canvas.rotate(30);
            canvas.rotate(-mValues[0]);
        }
        canvas.drawPath(mPath, mPaint);
    }

    @Override
    protected void onAttachedToWindow() {
        mAnimate = true;
        super.onAttachedToWindow();
    }
    
    @Override
    protected void onDetachedFromWindow() {
        mAnimate = false;
        super.onDetachedFromWindow();
    }
    
    
    
    
    
}
